[XEN][POWERPC] OFD dump prefix screen and hook into keyhandler
authorJimi Xenidis <jimix@watson.ibm.com>
Mon, 27 Nov 2006 22:17:07 +0000 (17:17 -0500)
committerJimi Xenidis <jimix@watson.ibm.com>
Mon, 27 Nov 2006 22:17:07 +0000 (17:17 -0500)
This patch adds the ability to view the devtree from the Xen console.
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
--HG--
extra : transplant_source : %CCE%28-%AF%3D%24/%DC%F6%E8X%C0%B1%8B%7F%10%86%A3%18

xen/arch/powerpc/boot_of.c
xen/arch/powerpc/of-devtree.h
xen/arch/powerpc/of-devwalk.c
xen/arch/powerpc/ofd_fixup.c
xen/arch/powerpc/setup.c

index 78a31d5b8790c43ac7889287205b127d83519fed..26a9ed19ebb1237d363089553c868db9898e98dc 100644 (file)
@@ -1069,7 +1069,7 @@ static void * __init boot_of_devtree(module_t *mod, multiboot_info_t *mbi)
     if (ofd_size(oft) > oft_sz)
          of_panic("Could not fit all devtree fixups\n");
 
-    ofd_walk(oft, OFD_ROOT, /* add_hype_props */ NULL, 2);
+    ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
 
     mod->mod_start = (ulong)oft;
     mod->mod_end = mod->mod_start + oft_sz;
index 09e836eff4f1fd749ca7758d79769919a99f79bf..8797b5d2e9839ebb52c7d0ec7a8d5c5eac267914 100644 (file)
@@ -115,10 +115,10 @@ extern u32 ofd_io_open(void *mem, ofdn_t n);
 extern void ofd_io_close(void *mem, ofdn_t n);
 
 
-typedef void (*walk_fn)(void *m, ofdn_t p, int arg);
-extern void ofd_dump_props(void *m, ofdn_t p, int dump);
+typedef void (*walk_fn)(void *m, const char *pre, ofdn_t p, int arg);
+extern void ofd_dump_props(void *m, const char *pre, ofdn_t p, int dump);
 
-extern void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg);
+extern void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg);
 
 
 /* Recursively look up #address_cells and #size_cells properties */
index dc57ab7ebedb4c305401756e7e39d27dd198cdb7..3f63697f130803a6db3c753c7908c6153a2f1c40 100644 (file)
@@ -80,7 +80,7 @@ void ofd_prop_print(
 #endif
 }
 
-void ofd_dump_props(void *mem, ofdn_t n, int dump)
+void ofd_dump_props(void *mem, const char *pre, ofdn_t n, int dump)
 {
     ofdn_t p;
     char name[128];
@@ -95,7 +95,7 @@ void ofd_dump_props(void *mem, ofdn_t n, int dump)
     }
 
     if (dump & OFD_DUMP_NAMES) {
-        printk("of_walk: %s: phandle 0x%x\n", path, n);
+        printk("%s: %s: phandle 0x%x\n", pre, path, n);
     }
 
     p = ofd_nextprop(mem, n, NULL, name);
@@ -106,30 +106,30 @@ void ofd_dump_props(void *mem, ofdn_t n, int dump)
         }
 
         if ( dump & OFD_DUMP_VALUES ) {
-            ofd_prop_print("of_walk", path, name, prop, sz);
+            ofd_prop_print(pre, path, name, prop, sz);
         }
 
         p = ofd_nextprop(mem, n, name, name);
     }
 }
 
-void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg)
+void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg)
 {
     ofdn_t n;
 
     if ( fn != NULL ) {
-        (*fn)(m, p, arg);
+        (*fn)(m, pre, p, arg);
     }
 
     /* child */
     n = ofd_node_child(m, p);
     if ( n != 0 ) {
-        ofd_walk(m, n, fn, arg);
+        ofd_walk(m, pre, n, fn, arg);
     }
 
     /* peer */
     n = ofd_node_peer(m, p);
     if ( n != 0 ) {
-        ofd_walk(m, n, fn, arg);
+        ofd_walk(m, pre, n, fn, arg);
     }
 }
index 3cb498dda91ceffaab1de26e6ca9909f2a319bcc..d4cae92f311c5056b2794400870799d9996469d8 100644 (file)
@@ -427,7 +427,7 @@ int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si)
 
 
 #ifdef DEBUG
-    ofd_walk(m, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
+    ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
 #endif
     return 1;
 }
index e0b6e504752056552cd07d3b12da5b0dbbd5530b..39245d425075d450dd16dde377df829c458bdc94 100644 (file)
@@ -125,11 +125,19 @@ void noinline __attn(void)
     console_end_sync();
 }
 
-static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs)
+static void key_hw_probe_attn(unsigned char key)
 {
     __attn();
 }
 
+static void key_ofdump(unsigned char key)
+{
+    printk("ofdump:\n");
+    /* make sure the OF devtree is good */
+    ofd_walk((void *)oftree, "devtree", OFD_ROOT,
+             ofd_dump_props, OFD_DUMP_ALL);
+}
+
 static void percpu_init_areas(void)
 {
     unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
@@ -180,7 +188,10 @@ static void __init start_of_day(void)
     /* Register another key that will allow for the the Harware Probe
      * to be contacted, this works with RiscWatch probes and should
      * work with Chronos and FSPs */
-    register_irq_keyhandler('^', hw_probe_attn,   "Trap to Hardware Probe");
+    register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe");
+
+    /* allow the dumping of the devtree */
+    register_keyhandler('D', key_ofdump , "Dump OF Devtree");
 
     timer_init();
     serial_init_postirq();
@@ -318,9 +329,7 @@ static void __init __start_xen(multiboot_info_t *mbi)
     memory_init(mod, mbi->mods_count);
 
 #ifdef OF_DEBUG
-    printk("ofdump:\n");
-    /* make sure the OF devtree is good */
-    ofd_walk((void *)oftree, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
+    key_ofdump(0);
 #endif
     percpu_init_areas();